/*
 * @Author: your name
 * @Date: 2020-05-13 23:31:58
 * @LastEditTime: 2020-05-14 21:25:58
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \ts\ts_test\interface.ts
 */

 interface Person {
   //[protype:string]:string|number;
   readonly name:string;
   age?:number | string;
   readonly id:number
 }

 let Yh:Person = {
   id:5555,
   name:'yihu',
   age:24,
  //  ccc:30,
  //  ddd:50
 }


//类 的描述
 interface Radio {
   name:string;
   swichRadio(triggere:boolean) : void
 }

 interface Battery {
   checkBatteryStaus():void
 }

 interface swichRadioBattry extends Battery,Radio{
   myPhone():string
 }

 class Car implements Radio {
   name: string
   constructor(name:string){
    this.name = name
  }
   swichRadio(triggere: boolean): void {
     console.log(triggere)
   }
 }

 class Cellphone implements Radio,Battery {
   name: string
   constructor(name:string){
     this.name = name
   }
   checkBatteryStaus(): void {
    console.log('实现方法')
   }
   swichRadio(triggere: boolean): void {
     console.log('实现方法')
   }
}

class Cellcomputer implements swichRadioBattry{
  name: string
  myPhone(): string {
    return "电脑"
  }
  checkBatteryStaus(): void {
    console.log('实现方法')
  }
  swichRadio(triggere: boolean): void {
    console.log('实现方法')
  }

}
